﻿

@*-------------------------  This template works with nullable date times ---*@

@*
@{
    DateTime dt = DateTime.Now;
    if (Model == null)
    {
       dt  = (System.DateTime) Model;
   
    }
    @Html.TextBox("", String.Format("{0:d}", dt.ToShortDateString()), new { @class = "datefield", @type = "date"  })
} 
*@


@*
@{
    DateTime dt = Model;
    @Html.TextBox("", String.Format("{0:d}", dt.ToShortDateString()), new { @class = "datefield", @type = "date"  })
} 
*@

@* --- Simplest working Template *@

@Html.TextBox("", String.Format("{0:d}",(string) Model.ToShortDateString()), new { @class = "datefield", @type = "date" })